const shellSort = (arr) => {
    for(let i = Math.floor(arr.length / 2); i > 0; i = Math.floor(i / 2)) {
        for(let j = i; j < arr.length; j += i) {
            for(let z = j - i; j >= 0 && arr[z] > arr[z+i]; z -= i) {
                let temp = arr[z]
                arr[z] = arr[z+i]
                arr[z+i] = temp
            }
            console.log(arr);
        }
    }
}
let arr = [1,2,1,5,3,10,9,6,8,4,2,6]
shellSort(arr)
console.log(arr);
// 1,2,1,5,3,10,9,6,8,4,2,6
// 12 / 2 = 6
// 1,2,1,5,3,10    9,6,8,4,2,6
// 1,2,1,4,2,6,9,6,8,5,3,10
// 6 / 2 = 3
// 1,2,1   4,2,6  9,6,8   5,3,10
// 1,2,1,4,2,6,5,3,8,9,6,10
// 3 / 2 = 1
// 1,1,2,2,3,4,5,6,8,6,9